import static org.junit.Assert.*;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.seleniumhq.jetty7.util.log.Log;


public class regexpTest {
	@Test
	public void regex(){
		
		FirefoxDriver driver= new FirefoxDriver();
		String URL="http://www.mail.yahoo.com";
		driver.get(URL);
//String sfblink=	("https://open.login.yahoo.com/openid/yrp/signin?idp=facebook&ts=139+[0-9]+[0-9]+[0-9]+[0-9]+[0-9]+[0-9]+[0-9]+[0-9]+&.intl=us&.lang=en-US&.done=http%3A%2F%2Fmail.yahoo.com&rpcrumb=[a-zA-Z0-9]+[a-zA-Z0-9]+[a-zA-Z0-9]+[a-zA-Z0-9]+[a-zA-Z0-9]+[a-zA-Z0-9]+[a-zA-Z0-9]+[a-zA-Z0-9]+[a-zA-Z0-9]+[a-zA-Z0-9]+&.src=ym");
	//	System.out.println(sfblink);
		String fbget=driver.findElement(By.id("fbLink")).getAttribute("href");
		System.out.println(fbget);
		
		//Pattern p = Pattern.compile("https://open.login.yahoo.com/openid/yrp/signin?idp=facebook&ts=139+[0-9]+[0-9]+[0-9]+[0-9]+[0-9]+[0-9]+[0-9]+[0-9]+&.intl=us&.lang=en-US&.done=http%3A%2F%2Fmail.yahoo.com&rpcrumb=[a-zA-Z0-9]+[a-zA-Z0-9]+[a-zA-Z0-9]+[a-zA-Z0-9]+[a-zA-Z0-9]+[a-zA-Z0-9]+[a-zA-Z0-9]+[a-zA-Z0-9]+[a-zA-Z0-9]+[a-zA-Z0-9]+&.src=ym?");
		//	Matcher m= p.matcher(fbget);
		//	System.out.println(m);
	//	String c="https://open.login.yahoo.com/openid/yrp/signin?idp=facebook&ts=139[0-9]+&.intl=us&.lang=en-US&.done=http%3A%2F%2Fmail.yahoo.com&rpcrumb=[a-zA-Z0-9]+&.src=ym?";
		//assertEquals("Result", sfblink, fbget);
	String str="https://open.login.yahoo.com/openid/yrp/signin?idp=facebook&ts=1393975202&.intl=us&.lang=en-US&.done=http%3A%2F%2Fmail.yahoo.com&rpcrumb=ZJMkr60PLSv&.src=ym";
		
	System.out.println("The matehced patterms:"+Pattern.matches("https://open.login.yahoo.com/openid/yrp/signin?idp=facebook&ts=139.*",fbget));
	
		driver.close();
		
	}

	

}
